// Copyright 2006 PR1ME. All Rights Reserved.
import java.util.List;

/**
 * Represents the user-specified options.
 */
public class UserSettings {

  /**
   * Constructs a user settings object with the specified settings.
   * 
   * @param fileNames the list of file names the user specifed
   * @param cAnalyzer a character analyzer based on the user options
   * @param wAnalyzer a word analyzer based on the user options
   * @param stopFileName the name of the file that contained the stop words, or
   *          <code>null</code> if there were no stop words
   */
  public UserSettings(List fileNames, CharacterAnalyzer cAnalyzer,
      WordAnalyzer wAnalyzer, String stopFileName) {
    this.fileName = (String[]) fileNames.toArray(new String[fileNames.size()]);
    this.cAnalyzer = cAnalyzer;
    this.wAnalyzer = wAnalyzer;
    this.stopFileName = stopFileName;
  }

  /**
   * @return a character analyzer representing the user's options
   */
  public CharacterAnalyzer getCharacterAnalyzer() {
    return cAnalyzer;
  }

  /**
   * @param index the index of the filename to retrieve
   * @return the index'th file the user specifed
   * @throws IndexOutOfBoundsException if index is less than 0 or greater than
   *           the file name count
   */
  public String getFileName(int index) {
    return fileName[index];
  }

  /**
   * @return the number of file names the user specified
   */
  public int getFileNameCount() {
    return fileName.length;
  }

  /**
   * @return the name of the file that contained the stop words, or
   *         <code>null</code> if there were no stop words
   */
  public String getStopFileName() {
    return stopFileName;
  }

  /**
   * @return a word analyzer representing the user's options
   */
  public WordAnalyzer getWordAnalyzer() {
    return wAnalyzer;
  }

  /**
   * A character analyzer representing the user's options.
   */
  private final CharacterAnalyzer cAnalyzer;

  /**
   * The list of input files the user specifed.
   */
  private final String[] fileName;

  /**
   * The name of the file that contained the stop words, or <code>null</code>
   * if there were no stop words.
   */
  private String stopFileName;

  /**
   * A word analyzer representing the user's options.
   */
  private final WordAnalyzer wAnalyzer;

}
